<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var str = 'abaasdffggghhjjkkgfddsssss3444343';

        console.log(str.length);

        console.log(str.charAt(0));
        console.log(str.charAt(3));
        console.log(str.charAt(5));
        console.log(str.charAt(0));

        for(var i = 0; i < str.length; i++){
            if(str.charAt(i)=='i'){
                console.log("i有");
            }else if(str.charAt(i)=='c'){
                console.log("c有");
            }else if(str.charAt(i)=='b'){
                console.log("b有");
            }else{
                console.log("i，c，b都没有");
            }
        }

        while(str.indexOf('g') != -1 && str.indexOf('ss') != -1 ){
            str = str.replace('g','22');
            str = str.replace('ss','b');
        }

        console.log(str.substr(1,5));

        var o = {};
        for(var i = 0; i < str.length; i++){
            var chars = str.charAt(i);
            if(o[chars]){
                o[chars]++;
            }else{
                o[chars] = 1;
            }
        }

        var max = 0;
        ch = '';
        for(var k in o){
            if(o[k] > max){
                max = o[k];
                ch = k;
            }
        }
        console.log(ch,max);
    </script>
</body>
</html>